﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;

namespace ValidationFramework.Tests.TestHelpers
{
    public static class StringExtensions
    {
        /// <summary>
        /// returns an XmlElement from the given string
        /// </summary>
        /// <param name="xmlString"></param>
        public static XmlElement ToXmlElement(this string xmlString)
        {
            var xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(xmlString);
            return xmlDocument.DocumentElement;
        }

        /// <summary>
        /// returns an XElement from the given string
        /// </summary>
        /// <param name="xmlString"></param>
        public static XElement ToXElement(this string xmlString)
        {
            return XElement.Load(xmlString);
        }
    }
}
